package com.karry.yl.service.assessment.impl;

import com.karry.commons.base.impl.SuperServiceImpl;
import com.karry.yl.dao.assessment.AssessRecordsMapper;
import com.karry.yl.domain.assessment.AssessRecords;
import com.karry.yl.service.assessment.AssessRecordsService;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 能力评估记录Service
 */
@Service
public class AssessRecordsServiceImpl extends SuperServiceImpl<AssessRecordsMapper, AssessRecords> implements AssessRecordsService {


    @Override
    public AssessRecords addAssess(AssessRecords assess) {
        int num=assess.getSelfEat()+assess.getSelfGarb()+assess.getSelfGoBed()+assess.getSelfLave()+assess.getSelfToilet()+assess.getSelfWalk();
        if(num>=4){
            assess.setRs(3);
        }else if(num>=1){
            assess.setRs(2);
        }else{
            assess.setRs(1);
        }
        baseMapper.insert(assess);
        return assess;
    }
}
